home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2007 December / PCWKCD1207B.iso / Blogowanie poza sfera / Scribefire-1.4.2 / scribefire-1.4.2-fx+fl.xpi / chrome / content / xmlrpc.js < prev   
Encoding:
JavaScript  |  2007-07-24  |  43.0 KB  |  1,052 lines

  1. /*
  2. XMLRPC Utility code.
  3. ------------------------------------------------------
  4. */
  5.  
  6. var DEBUG = false;
  7.  
  8. var gLastPostID = null;
  9. var gPFFTempObject = [];
  10. var gPFFRightAfterPost = false;
  11. var gPFFLastURIPost = "";
  12. var performancing_xmlcall = new Object();
  13. //performancing_atomcall = new Object();
  14.  
  15. performancing_xmlcall.init = function() {
  16.     this.lastResponseData = null;
  17.     this.dontautoformat = false;
  18.     this.appkey = "0123456789ABCDEF";
  19. }
  20.  
  21. //Send XMLRPC Command
  22. performancing_xmlcall.sendCommand = function(theURL, theXMLString, theAction, additionalInfo, theGUID, aCallFunction) { //Both arguments have to be strings
  23.     //gMakeXMLCall(theURL, theXMLString, theAction, additionalInfo, theGUID);
  24.     
  25.     var theCall = new PffXmlHttpReq(theURL, "POST", theXMLString, false, null, null);
  26.     
  27.     theCall.onResult = function( aText, aXML ){
  28.         aCallFunction(theCall.request.responseText, additionalInfo, theAction, theGUID);
  29.     }
  30.     theCall.onError = function (aStatusMsg, Msg) {
  31.         //foo
  32.     }
  33.     theCall.prepCall(); //Set up The call (open connection, etc.)
  34.     theCall.request.setRequestHeader("Content-Type", "text/xml");
  35.     theCall.makeCall(); //Make the call
  36.     theCall.request.overrideMimeType ('text/xml');
  37. }
  38.  
  39. performancing_xmlcall.processData = function(theXML, additionalInfo, theAction, theGUID, isAtom) {
  40.     var ourParsedResponse = null;
  41.     if(!isAtom){
  42.         var re = /(\<\?\xml[0-9A-Za-z\D]*\?\>)/;
  43.         var newstr = theXML.replace(re, "");
  44.         var e4xXMLObject = new XML(newstr);
  45.     
  46.         if (e4xXMLObject.name() != 'methodResponse' ||
  47.                 !(e4xXMLObject.params.param.value.length() == 1 ||
  48.                     e4xXMLObject.fault.value.struct.length() == 1)) {
  49.             var localeString = performancingUI.getLocaleString('apiurlnonexistant', []);
  50.             var localeString2 = performancingUI.getLocaleString('apiurlnonexistant', [gPFFLastURIPost]);
  51.             alert(localeString+"\n" + localeString2 + "\nXML Response:"+e4xXMLObject.toString());
  52.         }
  53.     
  54.         if (e4xXMLObject.params.param.value.length() == 1) {
  55.             ourParsedResponse = bfXMLRPC.XMLToObject(e4xXMLObject.params.param.value.children()[0]);
  56.         }
  57.         
  58.         if(e4xXMLObject.fault.children().length() > 0 ) {
  59.             ourParsedResponse = bfXMLRPC.XMLToObject( e4xXMLObject.fault.value.children()[0]);
  60.         }
  61.     }else{
  62.         ourParsedResponse = theXML;
  63.     }
  64.     this.lastResponseDataObject = ourParsedResponse;
  65.     
  66.     //Now do something!
  67.     if(theAction == "accountwizard"){
  68.         processReturnData(this.lastResponseDataObject, isAtom, theXML); //For account wizard calls
  69.     }else{
  70.         performancing_xmlcall.processReturnData(this.lastResponseDataObject , theAction, additionalInfo, isAtom, theGUID, newstr); //for all other calls
  71.     }
  72. }
  73.  
  74. performancing_xmlcall.replaceText = function(inString,oldText,newText) {
  75. return (inString.split(oldText).join(newText));
  76. }
  77.  
  78. performancing_xmlcall.processReturnData = function(theObject, theAction, additionalInfo, isAtom, theGUID, theXML){
  79.     var isError = false;
  80.     
  81.     if(!isAtom){
  82.         if(theObject.length == null){
  83.             if(theObject.faultString){
  84.                 if ((theAction != "pagelistcall") && (theAction != "newcategorycall")){
  85.                     var localeString = performancingUI.getLocaleString('requesterror', []);
  86.                        var localeString2 = performancingUI.getLocaleString('apiurlnonexistant', [theObject.faultString]);
  87.                        alert(localeString + "\n\n" + localeString2 + "\n\n" + theAction);
  88.                        performancingUI.okClearPost(false)
  89.                 }
  90.                 else {
  91.                     // Wordpress API pre new API
  92.                     gPerformancingUtil.serviceObject.supportsPages = false;
  93.                     gPerformancingUtil.serviceObject.addCategories = false;
  94.                     gPerformancingUtil.serviceObject.createCategories = false;
  95.                 }
  96.                 
  97.                    isError = true;
  98.             }
  99.         }
  100.     }
  101.     
  102.     if (theAction == "newcategorycall"){
  103.         if (isError){
  104.             // The category already exists.
  105.             var catArr = [additionalInfo];
  106.             var doNotCheckClear = performancingUI.hasCheckboxChildren('blog-sidebar-listing-categories');
  107.             gPerformancingUtil.setCategoriesSidebar(theCategoryArray, !doNotCheckClear);
  108.         }
  109.         else {
  110.             // We need to set the "cat" attribute to the id that was returned.
  111.             var catID = theObject.toString();
  112.             
  113.             var checkList = document.getElementById("blog-sidebar-listing-categories");
  114.             for (var i = 0; i < checkList.childNodes.length; i++) {
  115.                 if (checkList.childNodes[i].getAttribute("label") == additionalInfo){
  116.                     checkList.childNodes[i].setAttribute("cat",catID);
  117.                     break;
  118.                 }
  119.             }
  120.         }
  121.     }
  122.     else if ((theAction == "pagelistcall") && (!isError)){
  123.         gPerformancingUtil.serviceObject.supportsPages = true;
  124.         gPerformancingUtil.serviceObject.addCategories = true;
  125.         gPerformancingUtil.serviceObject.createCategories = true;
  126.         
  127.         // Wordpress blog whose API supports Pages and adding categories
  128.         window.setTimeout('gPerformancingUtil.getBlogPages("'+theGUID+'")', 1000, true);
  129.         document.getElementById("blog-sidebar-categories-addbtn").hidden = false;
  130.         
  131.         document.getElementById("blog-sidebar-listing-4").setAttribute("hidden","false");
  132.         document.getElementById("performancing-sb-tab4").setAttribute("hidden","false");
  133.     }
  134.     else if (theAction == "pagescall") {
  135.         if (DEBUG) alert("Parsing page XML.");
  136.     
  137.         gPerformancingUtil.clearListOut('performancing-pages-list');
  138.         
  139.         if(!isError){
  140.             var theTitle = null;
  141.             var theContent = null;
  142.             var moreContent = "";
  143.             var theCategories = "";
  144.             var thePostID = null;
  145.             var thePostLink = null;
  146.             var atomEditURI = null;
  147.             var blogName = document.getElementById("performancing-blogstatus").getAttribute('value');
  148.             gPerformancingUtil.clearPagesXMLFile();
  149.     
  150.             var numOfPosts = 10; 
  151.             
  152.             try {
  153.                 numOfPosts = gPerformancingUtil.prefs.getIntPref("display.history.numbertoshow");
  154.             } catch(e) {
  155.                 numOfPosts = 10;
  156.             }
  157.             
  158.             for(k = 0; k < theObject.length && k < numOfPosts; k++){
  159.                 try { theTitle = theObject[k].title.toString(); theTitle = theTitle.replace(/\s\s+/gi, " "); } catch(e) { theTitle = "Untitled" }
  160.                 try { theContent = theObject[k].description.toString(); } catch(e) { }
  161.                 try { thePostLink = theObject[k].permaLink.toString(); } catch(e) { thePostLink = ""; }
  162.                 try { theDateCreated = theObject[k].dateCreated.toString(); } catch(e) { theDateCreated = ""; }
  163.                 try { thePostID = theObject[k].page_id; } catch(e) { thePostID = ""; }
  164.     
  165.                 gPerformancingUtil.setPagesXML(thePostID, theContent, theTitle, theCategories, theDateCreated);
  166.     
  167.                 var tempArray = [theTitle];
  168.                 gPerformancingUtil.addItemToList([tempArray], k, 'performancing-pages-list', theGUID, theTitle, "gPerformancingUtil.addPageToEditor(this);", theDateCreated, thePostID );
  169.     
  170.                 if(gPFFRightAfterPost == true && gLastPostID == thePostID) {
  171.                     gPFFRightAfterPost = false;
  172.                     performancingUI.deliciousAddTechnorati(thePostLink, theTitle, isAtom, atomEditURI);
  173.                     window.setTimeout("performancingUI.sendTrackBacks('"+theTitle+"','"+thePostLink+"','"+blogName+"')", 2500, true);
  174.                 }
  175.             }
  176.             
  177.             gPerformancingUtil.savePagesXMLFile();
  178.         }
  179.     }
  180.     else if(theAction == "historycall"){
  181.         dump('\n Got History BlogObject: ' + theObject + '\n');
  182.         //gPFFTempObject.push(theObject);
  183.         gPerformancingUtil.clearListOut('performancing-history-list');
  184.         if(!isError){
  185.                 //aPostid, aTitle, aDescription, aDateCreated, aPublish
  186.                 //gPerformancingUtil.addItemToList(tempArray, j, 'performancing-history-list');
  187.                 //dump("History Response Length: "+theObject.length + "\n");
  188.                 gPerformancingUtil.clearListOut('performancing-history-list');
  189.                 var theTitle = null;
  190.                 var theContent = null;
  191.                 var theCategories = null;
  192.                 var thePostID = null;
  193.                 var thePostLink = null;
  194.                 var atomEditURI = null;
  195.                 var blogName = document.getElementById("performancing-blogstatus").getAttribute('value');
  196.                 gPerformancingUtil.clearHistoryXMLFile();
  197.                 
  198.                 var numOfPosts = 10; 
  199.                 try{
  200.                     numOfPosts = gPerformancingUtil.prefs.getIntPref("display.history.numbertoshow");
  201.                 }catch(e){
  202.                     numOfPosts = 10;
  203.                 }
  204.                 
  205.                 for(k = 0; k < theObject.length && k < numOfPosts; k++){
  206.                     //gBlogObject[k].postid, gBlogObject[k].postDate
  207.                     try{
  208.                         //dump("Try finding .TITLE \n");
  209.                         theTitle = theObject[k].title.toString();
  210.                     }catch(e){
  211.                         theTitle = "Untitled"
  212.                     }
  213.                     //Remove any extra spaces (atleast 2 or more consecutive spaces)
  214.                     theTitle = theTitle.replace(/\s\s+/gi, " ");
  215.                     try{
  216.                         theContent = theObject[k].content.toString();
  217.                     }catch(e){
  218.                         
  219.                     }
  220.                     
  221.                     try{
  222.                         theContent = theObject[k].description.toString();
  223.                         //alert("theContent: "+ theContent)
  224.                     }catch(e){
  225.                         //alert("Content Error: "+ e)
  226.                     }
  227.                     dump("\n\n History Content: \n" +theContent+ "\n\n");
  228.                     //categories
  229.                     var moreContent = "";
  230.                     try{
  231.                         moreContent = theObject[k].mt_text_more.toString();
  232.                     }catch(e){
  233.                     }
  234.                     if(moreContent != ""){
  235.                         theContent = theContent + "<!--more-->" + moreContent;
  236.                     }
  237.                     
  238.                     try{
  239.                         theCategories = theObject[k].categories.toString();
  240.                         //alert("theCategories: " + theCategories);
  241.                     }catch(e){
  242.                         theCategories = "";
  243.                     }
  244.                     
  245.                      //links
  246.                     try{
  247.                         thePostLink = theObject[k].permaLink.toString();
  248.                     }catch(e){
  249.                         thePostLink = "";
  250.                     }
  251.                     
  252.                     //theDateCreated
  253.                     try{
  254.                         theDateCreated = theObject[k].dateCreated.toString();
  255.                     }catch(e){
  256.                         theDateCreated = "";
  257.                     }
  258.                     
  259.                      //Atom links
  260.                     try{
  261.                         atomEditURI = theObject[k].editURI.toString();
  262.                         //thePostLink = atomEditURI;
  263.                     }catch(e){
  264.                         atomEditURI = "";
  265.                     }
  266.                     
  267.                     try{
  268.                         if(theObject[k].postid == null){
  269.                             thePostID = theObject[k].postId; //LiveJournal Hack, bastards!!
  270.                         }else{
  271.                             thePostID = theObject[k].postid;
  272.                         }
  273.                     }catch(e){
  274.                         thePostID = "";
  275.                     }
  276.                     //gPFFTempObject.push(thePostID);
  277.                     
  278.                     gPerformancingUtil.setHistoryXML(thePostID, theContent, theTitle, theCategories, theDateCreated);
  279.                     
  280.                     var tempArray = [ theTitle];
  281.                     //dataArray, number, listIDname, theGUID, theURL, onItemClick, aDate, aPostId
  282.                     gPerformancingUtil.addItemToList([tempArray], k, 'performancing-history-list', theGUID, theTitle, "gPerformancingUtil.addHistoryItemToEditor( this );", theDateCreated, thePostID );
  283.                     
  284.                     if( gPFFRightAfterPost == true && gLastPostID == thePostID ){
  285.                         gPFFRightAfterPost = false;
  286.                         performancingUI.deliciousAddTechnorati(thePostLink, theTitle, isAtom, atomEditURI);
  287.                         window.setTimeout("performancingUI.sendTrackBacks('"+theTitle+"','"+thePostLink+"','"+blogName+"')", 2500, true);
  288.                     }
  289.                 }
  290.                 gPerformancingUtil.saveHistoryXMLFile();
  291.         }
  292.     }else if(theAction == "categorycall"){
  293.         //dump('\n Got Categorycall BlogObject: ' + theObject + '\n');
  294.         if(!isError){
  295.             //dump("Response Length: "+theObject.length + "\n");
  296.             gPerformancingUtil.clearCheckListOut('blog-sidebar-listing-categories');
  297.             //gBlogObject.categoryId, gBlogObject.categoryName
  298.             //gPFFTempObject = theObject;
  299.             var theCatArray = [];
  300.             var theCatIdArray = [];
  301.             if( theObject.length >= 0 ){
  302.                 for(k = 0; k < theObject.length; k++){
  303.                     //ROLLER metaWebLoghack
  304.                     var tempArray = null;
  305.                     try{
  306.                         if(theObject[k].categoryName.toString() != ""){
  307.                             tempArray = [theObject[k].categoryName];
  308.                         }
  309.                     }catch(e){
  310.                         try{
  311.                             if(theObject[k].title.toString() != ""){
  312.                                 tempArray = [theObject[k].title];
  313.                             }
  314.                         }catch(e){
  315.                             if(theObject[k].description.toString() != ""){
  316.                             tempArray = [theObject[k].description];
  317.                             }
  318.                         }
  319.                     }
  320.                     //gPerformancingUtil.addItemToCheckList([tempArray], k, 'blog-sidebar-listing-categories', null, theObject[k].categoryId, "" );
  321.                     theCatArray.push(tempArray + "," + theObject[k].categoryId);
  322.                     //theCatIdArray.push(theObject[k].categoryId);
  323.                 }
  324.                 
  325.                 //Should we sort the list?
  326.                 var doTheSort = false;
  327.                 try{
  328.                     doTheSort = gPerformancingUtil.prefs.getBoolPref("display.sortcats");
  329.                 }catch(e){
  330.                     doTheSort = false;
  331.                 }
  332.                 
  333.                 function sortTags(a, b) {
  334.                     a = a.toLowerCase();
  335.                     b = b.toLowerCase();
  336.                     if (a < b) return -1;
  337.                     else if (b < a) return 1;
  338.                     else return 0;
  339.                 }
  340.                 
  341.                 if(doTheSort){
  342.                     theCatArray.sort(sortTags);
  343.                 }
  344.                 
  345.                 //Now add the Cat List
  346.                 var theCatID = "";
  347.                 for(l = 0; l < theCatArray.length; l++){
  348.                     theNewCatArray = theCatArray[l].split(",");
  349.                     gPerformancingUtil.addItemToCheckList([theNewCatArray[0]], l, 'blog-sidebar-listing-categories', null, theNewCatArray[1], "" );
  350.                 }
  351.                 
  352.             }else{
  353.                 for(x in theObject){ 
  354.                     var tempArray = x.toString();
  355.                     gPerformancingUtil.addItemToCheckList([tempArray], 0, 'blog-sidebar-listing-categories', null, '', "" );
  356.                 }
  357.             }
  358.         }
  359.     }else if(theAction == "newpostcall"){
  360.         if(!isError){
  361.             gPFFRightAfterPost = true;
  362.             //dump('\n Got New Post BlogObject: ' + theObject + '\n');
  363.             //Call clear content and mark as posted to user!
  364.             performancingUI.postSuccessful();
  365.             performancingUI.toggleEnableOnPost();
  366.             
  367.             //Fix for Blogger/ATOM
  368.             if(theObject.uid != null){
  369.                 gLastPostID = theObject.uid;
  370.             }else{
  371.                 gLastPostID = theObject;
  372.             }
  373.             gLastPostID = gLastPostID.toString();
  374.             //Now set the category (if there are categories checked)
  375.             gPerformancingUtil.setCategoryList(gLastPostID, additionalInfo);
  376.             
  377.             //window.setTimeout('gPerformancingUtil.setCategoryList("'+theObject + ","+ additionalInfo+'")', 1000, true);
  378.             theGUID = gPerformancingUtil.prefs.getCharPref("settings.lastselected.blog");
  379.             var theBlogURL = document.getElementById("blog-group").selectedItem.getAttribute("tooltiptext");
  380.             var blogName = document.getElementById("performancing-blogstatus").getAttribute('value');
  381.             
  382.             window.setTimeout("performancingUI.doPing(\""+ blogName+"\",\""+ theBlogURL+"\")", 3000, true);
  383.             
  384.             window.setTimeout('gPerformancingUtil.getBlogHistory("'+theGUID+'")', 2000, true);
  385.             //gPerformancingUtil.getBlogHistory(theGUID);
  386.         }
  387.     }else if(theAction == "newpagecall"){
  388.         if(!isError){
  389.             gPFFRightAfterPost = true;
  390.             
  391.             //Call clear content and mark as posted to user!
  392.             performancingUI.postSuccessful();
  393.             performancingUI.toggleEnableOnPost();
  394.             
  395.             //Fix for Blogger/ATOM
  396.             if(theObject.uid != null){
  397.                 gLastPostID = theObject.uid;
  398.             }else{
  399.                 gLastPostID = theObject;
  400.             }
  401.             gLastPostID = gLastPostID.toString();
  402.             
  403.             theGUID = gPerformancingUtil.prefs.getCharPref("settings.lastselected.blog");
  404.             var theBlogURL = document.getElementById("blog-group").selectedItem.getAttribute("tooltiptext");
  405.             var blogName = document.getElementById("performancing-blogstatus").getAttribute('value');
  406.             
  407.             window.setTimeout("performancingUI.doPing(\""+ blogName+"\",\""+ theBlogURL+"\")", 3000, true);
  408.             
  409.             window.setTimeout('gPerformancingUtil.getBlogPages("'+theGUID+'")', 2000, true);
  410.         }
  411.     }else if(theAction == "editpostcall"){
  412.         if(!isError){
  413.             gPFFRightAfterPost = true;
  414.             //dump('\n Got Edit Post BlogObject: ' + theObject + '\n');
  415.             //Call clear content and mark as posted to user!
  416.             performancingUI.postSuccessful();
  417.             performancingUI.toggleEnableOnPost();
  418.             
  419.             //Now set the category (if there are categories checked)
  420.             var pubButton = document.getElementById("performancing-republish-button");
  421.             var thePostID = pubButton.getAttribute("lastpostid");
  422.             gPerformancingUtil.setCategoryList(thePostID, additionalInfo);
  423.             
  424.             //window.setTimeout('gPerformancingUtil.setCategoryList("'+theObject + ","+ additionalInfo+'")', 1000, true);
  425.             theGUID = gPerformancingUtil.prefs.getCharPref("settings.lastselected.blog");
  426.             
  427.             var theBlogURL = document.getElementById("blog-group").selectedItem.getAttribute("tooltiptext");
  428.             var blogName = document.getElementById("performancing-blogstatus").getAttribute('value');
  429.             window.setTimeout("performancingUI.doPing('"+ blogName+"','"+ theBlogURL+"')", 3000, true);
  430.             
  431.             window.setTimeout('gPerformancingUtil.getBlogHistory("'+theGUID+'")', 2000, true);
  432.             //gPerformancingUtil.getBlogHistory(theGUID);
  433.             gLastPostID = thePostID;
  434.         }
  435.     }else if(theAction == "setcategoriescall"){
  436.         //dump('\n Categories got set!!\n');
  437.         //Now publish it! This fixes a typepad category bug
  438.         //gPerformancingUtil.publishThePost(gLastPostID);
  439.         //Now publish it! This fixes a typepad category bug
  440.         var isDraft = document.getElementById("performancing-draft-checkbox").checked;
  441.         if(!isDraft){
  442.             gPerformancingUtil.publishThePost(gLastPostID);
  443.         }
  444.         //window.setTimeout('gPerformancingUtil.publishThePost("'+gLastPostID+'")', 2000, true);
  445.     }else if(theAction == "deletehistorycall"){
  446.         //dump('\n\n Post Deleted!!\n');
  447.         theGUID = gPerformancingUtil.prefs.getCharPref("settings.lastselected.blog");
  448.         gPerformancingUtil.getBlogHistory(theGUID); //re get the new list now
  449.         var localeString = performancingUI.getLocaleString('postdeleted', []);
  450.         alert(localeString);
  451.         
  452.         var editButtons = document.getElementById("post-edit-buttons");
  453.         editButtons.hidden = true;
  454.     }else if(theAction == "deletepagecall"){
  455.         theGUID = gPerformancingUtil.prefs.getCharPref("settings.lastselected.blog");
  456.         gPerformancingUtil.getBlogPages(theGUID); //re get the new list now
  457.         var localeString = performancingUI.getLocaleString('pagedeleted', []);
  458.         alert(localeString);
  459.         
  460.         var editButtons = document.getElementById("post-edit-buttons");
  461.         editButtons.hidden = true;
  462.     }else if(theAction == "newMediaObjectcall"){
  463.     }else{
  464.         //dump('\n Got Some other unknown BlogObject: ' + theObject + '\n');
  465.     }
  466.     
  467.     
  468.     if(isError){
  469.         document.getElementById('blog-sidebar-listing-0').disabled = false;
  470.         //document.getElementById('performancing-account-wizard').advance("success");
  471.         //alert("Error sending data");
  472.         return true;
  473.     }else{
  474.          //document.getElementById('blog-sidebar-listing-categories').disabled = false;
  475.          document.getElementById('blog-sidebar-listing-0').disabled = false;
  476.          
  477.          //document.getElementById('performancing-account-wizard').advance("login-error");
  478.          //alert("Error sending data");
  479.          return true;
  480.     }
  481. }
  482.  
  483. /* TODO - Have only one xmlhttp request  */
  484.  
  485. //REMOVE
  486. function gMakeXMLCall(theURL, message, theAction, additionalInfo, theGUID) {
  487.  //gPFFTempObject.push(message);
  488.  var xmlhttp = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Components.interfaces.nsIXMLHttpRequest);
  489.  xmlhttp.open('POST', theURL, true);
  490.  gPFFLastURIPost = theURL;
  491.  xmlhttp.onreadystatechange=function() {
  492.       if (xmlhttp.readyState==4) {
  493.           if (xmlhttp.status == 200) { //We actually want to catch bad pages
  494.               if(theAction == "atomAPIpost"){
  495.                   performancingUI.addDeliciousTechnoratiATOM( xmlhttp.responseText, additionalInfo );
  496.               }else{
  497.                   //gPFFTempObject.push(xmlhttp.responseText) ;
  498.                   //processData = function(theXML, additionalInfo, theAction, theGUID, isAtom)
  499.                   performancing_xmlcall.processData(xmlhttp.responseText, additionalInfo, theAction, theGUID, null);
  500.               }
  501.           }else{
  502.               //dump("Bad XML return: " + xmlhttp.readyState + "\n");
  503.           }
  504.       }
  505.  }
  506.  xmlhttp.setRequestHeader("Content-Type", "text/xml");
  507.  xmlhttp.setRequestHeader('Content-Length', message.length );
  508.  xmlhttp.setRequestHeader("User-Agent", "Mozilla/5.0 (compatible; ScribeFire; http://www.scribefire.com/)");
  509.  xmlhttp.send(message); 
  510.  xmlhttp.overrideMimeType ('text/xml');
  511. }
  512.  
  513. //REMOVE
  514. function gMakeXMLCall2(theURL, message, theAction, additionalInfo, theGUID) {
  515.     
  516.  var xmlhttp = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Components.interfaces.nsIXMLHttpRequest);
  517.  xmlhttp.open('GET', theURL, true);
  518.  gPFFLastURIPost = theURL;
  519.  xmlhttp.onreadystatechange=function() {
  520.       if (xmlhttp.readyState==4) {
  521.           if (xmlhttp.status == 200) { //We actually want to catch bad pages
  522.               //xmlhttp.responseText
  523.               if(theAction == "atomAPIpost"){
  524.                   //alert("RESPONSE BABY: " +  xmlhttp.responseText);
  525.                   performancingUI.addDeliciousTechnoratiATOM( xmlhttp.responseText, additionalInfo );
  526.               }else if(theAction == "ping"){
  527.                   //alert("RESPONSE BABY: " +  xmlhttp.responseText);
  528.                   performancingUI.processPingRecData(xmlhttp.responseText, message, theAction);
  529.               }else if(theAction == "checklogin"){
  530.                   var isLoggedin = xmlhttp.responseText.search(/User Login/);
  531.                   //alert("Login: "+isLoggedin);
  532.               }else if(theAction == "accountw-autodetect"){
  533.                   prossessAutoDetectPage(message, xmlhttp.responseXML);
  534.                   //alert("Login: "+isLoggedin);
  535.               }
  536.               //performancing_xmlcall.processData(xmlhttp.responseXML);
  537.               //dump("Requested Test 2: this.req.statusText: " + xmlhttp.statusText + "\n");
  538.               //dump("Requested Test 2: this.req.status: " + xmlhttp.status + "\n");
  539.               //dump("Requested Test 2: this.req.readyState: " + xmlhttp.readyState + "\n");
  540.               //dump("Requested Test 2: this.req.responseText: " + xmlhttp.responseText + "\n");
  541.           }else{
  542.               //dump("Bad XML return: " + xmlhttp.readyState + "\n");
  543.           }
  544.       }
  545.  }
  546.  //xmlhttp.send(null)
  547.  if(theAction != "checklogin"){
  548.      xmlhttp.setRequestHeader("Content-Type", "text/xml");
  549.      xmlhttp.setRequestHeader("User-Agent", "ScribeFire " + gPerformancingVersionUA);
  550.      xmlhttp.overrideMimeType ('text/xml');
  551.  }
  552.  xmlhttp.send(message);
  553.  //dump("\nXML SENT: " + message + "\n");
  554. }
  555.  
  556. //REMOVE
  557. function gMakeXMLCall3(theURL, message, theAction, additionalInfo, theGUID) {
  558.     
  559.  var xmlhttp = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Components.interfaces.nsIXMLHttpRequest);
  560.  xmlhttp.open('GET', theURL, true);
  561.  xmlhttp.onreadystatechange=function() {
  562.       if (xmlhttp.readyState==4) {
  563.           if (xmlhttp.status == 200) { //We actually want to catch bad pages
  564.               //xmlhttp.responseText
  565.               if(theAction == "accountw-autodetect"){
  566.                   doProssessAutoDetectPage(message, xmlhttp.responseText, "1");
  567.               }else if(theAction == "accountw-autodetect-2"){
  568.                   doProssessAutoDetectPage(message, xmlhttp.responseXML, "2");
  569.               }
  570.           }else{
  571.               //dump("Bad XML return: " + xmlhttp.readyState + "\n");
  572.           }
  573.       }
  574.  }
  575.  xmlhttp.send(null)
  576.  xmlhttp.overrideMimeType ('text/xml');
  577.  //xmlhttp.send(message);
  578.  //dump("\nXML SENT: " + message + "\n");
  579. }
  580.  
  581. //application/x-www-form-urlencoded
  582. function gMakeTrackBackXMLCall(theURL, message, theAction, additionalInfo, aNumber, aSecondTry, theGUID) {
  583.     
  584.  var xmlhttp = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Components.interfaces.nsIXMLHttpRequest);
  585.  xmlhttp.open('POST', theURL, true);
  586.  gPFFLastURIPost = theURL;
  587.  xmlhttp.onreadystatechange=function() {
  588.       if (xmlhttp.readyState==4) {
  589.           if (xmlhttp.status == 200) { //We actually want to catch bad pages
  590.               //xmlhttp.responseText
  591.               if(theAction == "trackback"){
  592.                   //alert("RESPONSE BABY: " +  xmlhttp.responseText);
  593.                   performancingUI.trackBackResponse( xmlhttp.responseText, theURL, message, theAction, additionalInfo, aNumber, aSecondTry, theGUID);
  594.               }
  595.               //performancing_xmlcall.processData(xmlhttp.responseXML);
  596.               //dump("Requested Test 2: this.req.statusText: " + xmlhttp.statusText + "\n");
  597.               //dump("Requested Test 2: this.req.status: " + xmlhttp.status + "\n");
  598.               //dump("Requested Test 2: this.req.readyState: " + xmlhttp.readyState + "\n");
  599.               //dump("Requested Test 2: this.req.responseText: " + xmlhttp.responseText + "\n");
  600.           }else{
  601.               //dump("Bad XML return: " + xmlhttp.readyState + "\n");
  602.           }
  603.       }
  604.  }
  605.  //xmlhttp.send(null) 
  606.  xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  607.  xmlhttp.setRequestHeader('Content-Length', message.length );
  608.  xmlhttp.send(message); 
  609.  //dump("\nXML SENT: " + message + "\n");
  610. }
  611.  
  612. //REMOVE
  613. function gMakeDeliciousXMLCall(theURL, message, theAction, userName, passWord) {
  614.     
  615.  var xmlhttp = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Components.interfaces.nsIXMLHttpRequest);
  616.  //rval = this._req.open(method, url, true, this._user, this._pass);
  617.  xmlhttp.open('GET', theURL, true, userName, passWord);
  618.  gPFFLastURIPost = theURL;
  619.  xmlhttp.onreadystatechange=function() {
  620.       if (xmlhttp.readyState==4) {
  621.           if (xmlhttp.status == 200) { //We actually want to catch bad pages
  622.               performancingUI.deliciousResponse(xmlhttp.responseText, message, theAction, userName, passWord);
  623.           }else{
  624.               //dump("Bad XML return: " + xmlhttp.readyState + "\n");
  625.           }
  626.       }
  627.  }
  628.  //xmlhttp.send(null) 
  629.  xmlhttp.setRequestHeader("Content-Type", "text/xml");
  630.  xmlhttp.setRequestHeader("User-Agent", "ScribeFire " + gPerformancingVersionUA);
  631.  //xmlhttp.setRequestHeader('Content-Length', message.length );
  632.  //xmlhttp.send(message);
  633.  xmlhttp.send("");  
  634.  xmlhttp.overrideMimeType ('text/xml');
  635.  //dump("\nXML SENT: " + message + "\n");
  636. }
  637.  
  638. //REMOVE
  639. function gMakePingXMLCall(theURL, message, theAction) {
  640.     
  641.  var xmlhttp = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Components.interfaces.nsIXMLHttpRequest);
  642.  //rval = this._req.open(method, url, true, this._user, this._pass);
  643.  xmlhttp.open('POST', theURL, true);
  644.  gPFFLastURIPost = theURL;
  645.  xmlhttp.onreadystatechange=function() {
  646.       if (xmlhttp.readyState==4) {
  647.           if (xmlhttp.status == 200) { //We actually want to catch bad pages
  648.               //xmlhttp.responseText
  649.               performancingUI.processPingRecData(xmlhttp.responseText, message, theAction);
  650.               //performancing_xmlcall.processData(xmlhttp.responseXML);
  651.               //dump("Requested Test 2: this.req.statusText: " + xmlhttp.statusText + "\n");
  652.               //dump("Requested Test 2: this.req.status: " + xmlhttp.status + "\n");
  653.               //dump("Requested Test 2: this.req.readyState: " + xmlhttp.readyState + "\n");
  654.               //dump("Requested Test 2: this.req.responseText: " + xmlhttp.responseText + "\n");
  655.           }else{
  656.               //dump("Bad XML return: " + xmlhttp.readyState + "\n");
  657.           }
  658.       }
  659.  }
  660.  //xmlhttp.send(null) 
  661.  xmlhttp.setRequestHeader("Content-Type", "text/xml");
  662.  xmlhttp.setRequestHeader("User-Agent", "ScribeFire " + gPerformancingVersionUA);
  663.  xmlhttp.setRequestHeader('Content-Length', message.length );
  664.  xmlhttp.send(message); 
  665.  xmlhttp.overrideMimeType ('text/xml');
  666.  //dump("\nXML SENT: " + message + "\n");
  667. }
  668.  
  669. var bfXMLRPC = new Object();
  670.  
  671. bfXMLRPC.makeXML = function(method, myParams, isAtom) {
  672.     if(!isAtom){
  673.         var xml = <methodCall></methodCall>;
  674.         xml.methodName = method;
  675.         //i->0 is the URL
  676.         for(var i=1; i < myParams.length; i++){
  677.             xml.params.param += <param> <value> { bfXMLRPC.convertToXML(myParams[i], isAtom) }</value> </param>;
  678.         }
  679.         
  680.         var theBlogCharType = "UTF-8";
  681.         
  682.         return '<?xml version="1.0" encoding="' + theBlogCharType + '" ?>' + xml.toXMLString();
  683.     }
  684.     
  685.     return 0;
  686. }
  687.  
  688. bfXMLRPC.convertToXML = function(myParams, isAtom) {
  689.     //gPFFTempObject = myParams;
  690.     if(!isAtom){
  691.         var paramType = myParams.constructor.name;
  692.         var paramTemp = null;
  693.         switch (paramType){
  694.             
  695.           case "Number"://12, 12.12, etc.
  696.             if( myParams == parseInt(myParams) ){
  697.                 paramTemp = "<int>" + myParams + "</int>";
  698.             }else{
  699.                 paramTemp = "<double>" + myParams + "</double>";
  700.             }
  701.             break;
  702.             
  703.           case "String":
  704.             if( myParams.toString() == 'bool1'){
  705.                 paramTemp = "<boolean>1</boolean>";
  706.             }else if( myParams.toString() == 'bool0' ){
  707.                 paramTemp = "<boolean>0</boolean>";
  708.             }else{
  709.                 paramTemp = "<string><![CDATA[" + myParams + "]]></string>";
  710.             }
  711.             break;
  712.             
  713.           case "Boolean"://0,1, true, false
  714.             paramTemp = "<boolean>" + myParams + "</boolean>";
  715.             break;
  716.             
  717.           case "Date": //Date Object: var date = new Date();
  718.             var theDate = bfXMLRPC.iso8601Format(myParams).toString();
  719.             var theErrorString = "NaNNaNNaNTNaN:NaN:NaN";
  720.             if(theDate != theErrorString){
  721.                 paramTemp = "<dateTime.iso8601>" + theDate + "</dateTime.iso8601>";
  722.             }else{
  723.                 paramTemp = "<dateTime.iso8601></dateTime.iso8601>";
  724.             }
  725.             break;
  726.             
  727.           case "Array": //Array Object
  728.             var tempVal = "<array><data>";
  729.             //for(var i=0;i<myParams.length;++i)
  730.             for(var i = 0; i < myParams.length; i++)
  731.             {
  732.                 //dump("\n i: " + i + "\n")
  733.                 tempVal += "<value>" + bfXMLRPC.convertToXML(myParams[i]) + "</value>";
  734.             }
  735.             tempVal += "</data></array>";
  736.             paramTemp = tempVal;
  737.             break;
  738.             
  739.           case "Object": //Array Object
  740.             var tempVal = "<struct>";
  741.             //for(var i=0;i<myParams.length;++i)
  742.             for(x in myParams)
  743.             {
  744.                 if(myParams[x].constructor.name == 'String'){
  745.                     if(x == "bits"){
  746.                         tempVal += "<member><name>" + x + "</name>" + "<value><base64><![CDATA[" +bfXMLRPC.convertToXML(myParams[x]) + "]]></base64></value>" +"</member>";
  747.                     }else{
  748.                         tempVal += "<member><name>" + x + "</name>" + "<value><string><![CDATA[" +bfXMLRPC.convertToXML(myParams[x]) + "]]></string></value>" +"</member>";
  749.                     }
  750.                     
  751.                 }else if(myParams[x].constructor.name == 'Date'){
  752.                     var theDate = bfXMLRPC.iso8601Format(myParams[x]).toString();
  753.                     var theErrorString = "NaNNaNNaNTNaN:NaN:NaN";
  754.                     if(theDate != theErrorString){
  755.                         tempVal += "<member><name>" + x + "</name>" + "<value>" +"<dateTime.iso8601>" + theDate + "</dateTime.iso8601>" + "</value>" +"</member>";
  756.                     }else{
  757.                         tempVal += "<member><name>" + x + "</name>" + "<value>" +"<dateTime.iso8601></dateTime.iso8601>" + "</value>" +"</member>";
  758.                     }
  759.                     
  760.                 }else if(myParams[x].constructor.name == 'Number'){
  761.                     if( myParams[x] == parseInt(myParams[x]) ){
  762.                         tempVal += "<member><name>" + x + "</name>" + "<value>" +"<int>"  +bfXMLRPC.convertToXML(myParams[x]) + "</int>" + "</value>" +"</member>";
  763.                     }else{
  764.                         tempVal += "<member><name>" + x + "</name>" + "<value>" + "<double>" + bfXMLRPC.convertToXML(myParams[x]) + "</double>" + "</value>" +"</member>";
  765.                     }
  766.                 }else{
  767.                     tempVal += "<member><name>" + x + "</name>" + "<value>" +bfXMLRPC.convertToXML(myParams[x]) + "</value>" +"</member>";
  768.                 }
  769.                 //dump('Current tempVal: ' + tempVal + '\n');
  770.             }
  771.             tempVal += "</struct>";
  772.             paramTemp = tempVal;
  773.             break;
  774.             
  775.           default:
  776.             paramTemp = "<![CDATA[" + myParams + "]]>";
  777.             break;
  778.             
  779.         }
  780.             
  781.         //var paramObject = new XML("<string>" + myParams +"</string>");
  782.         var paramObject = new XML(paramTemp);
  783.         
  784.         return paramObject;
  785.     }
  786.     
  787.     return 0;
  788. }
  789.  
  790. //XMLToObject is derived from GPL code originally by Flock Inc:
  791. //For the original source, see: http://cvs-mirror.flock.com/index.cgi/mozilla/browser/components/flock/xmlrpc/content/xmlrpchelper.js?rev=1.1&content-type=text/vnd.viewcvs-markup
  792. bfXMLRPC.XMLToObject = function(xml) {
  793.     try{
  794.         if (xml.nodeKind()) {
  795.             //foo
  796.         }
  797.     }catch(e){
  798.         //foo
  799.         xml = new XML(xml);
  800.     }
  801.     //gPFFTempObject = xml;
  802.     
  803.     if (xml.nodeKind() == 'text') {
  804.             // the default type in string
  805.             return xml.toString();
  806.     }
  807.         
  808.     switch (xml.name().toString()) {
  809.         case 'int':
  810.         case 'i4':
  811.             return parseInt (xml.text());
  812.         case 'boolean':
  813.             return (parseInt (xml.text()) == 1);
  814.         case 'string':
  815.             return (xml.text().toString());
  816.         case 'double':
  817.             return parseFloat (xml.text());
  818.         case 'dateTime.iso8601':
  819.             var val = xml.text().toString();
  820.             //MSN Spaces hack for dates that look like: 2006-01-26T07:24:20Z
  821.             val = val.replace(/\-/gi, "");
  822.             val = val.replace(/\z/gi, "");
  823.             //end MSN hack
  824.             var dateutc =  Date.UTC(val.slice(0, 4), val.slice(4, 6) - 1, 
  825.                     val.slice(6, 8), val.slice(9, 11), val.slice(12, 14), 
  826.                     val.slice(15));
  827.             //alert('Date Val: ' + val + " RealDate: "+ new Date(dateutc));
  828.             return new Date(dateutc);
  829.         case 'array':
  830.             var arr = new Array ();
  831.             for (var i=0; i<xml.data.value.length(); i++) {
  832.                 arr.push (bfXMLRPC.XMLToObject(xml.data.value[i].children()[0]));
  833.             }
  834.             return arr;
  835.         case 'struct':
  836.             var struct = new Object ();
  837.             for (var i=0; i < xml.member.length(); i++) {
  838.                 struct[xml.member[i].name.text()] = 
  839.                     bfXMLRPC.XMLToObject(xml.member[i].value.children()[0]);
  840.             }
  841.             return struct;
  842.             
  843.         default:
  844.             //dump('error parsing XML');
  845.     }
  846. }
  847.  
  848. //Function is derived from GPL code originally by Flock Inc:
  849. //For more informationm See:
  850. bfXMLRPC.iso8601Format = function(date) 
  851. {
  852.     var datetime = date.getUTCFullYear();
  853.     var month = String(date.getUTCMonth() + 1);
  854.     datetime += (month.length == 1 ?  '0' + month : month);
  855.     var day = date.getUTCDate();
  856.     datetime += (day < 10 ? '0' + day : day);
  857.  
  858.     datetime += 'T';
  859.  
  860.     var hour = date.getUTCHours();
  861.     datetime += (hour < 10 ? '0' + hour : hour) + ':';
  862.     var minutes = date.getUTCMinutes();
  863.     datetime += (minutes < 10 ? '0' + minutes : minutes) + ':';
  864.     var seconds = date.getUTCSeconds();
  865.     datetime += (seconds < 10 ? '0' + seconds : seconds);
  866.  
  867.     return datetime;
  868. }
  869.  
  870. bfXMLRPC.setUpBlogObject = function(theBlogXML) {
  871.     var theXMLObject = theBlogXML;
  872.     var apiObject = null;
  873.     var aService = null;
  874.     
  875.     if(theXMLObject.blogapi.toString() == ""){
  876.         aService = theXMLObject.blogtype.toString(); //for legacy 1.0 release issues
  877.     }
  878.     else{
  879.         aService = theXMLObject.blogapi.toString();
  880.     }
  881.     
  882.     if (DEBUG) alert("Using API: " + aService);
  883.     
  884.     // Determine the API type from either the blogtype value of the blogapi value.
  885.     switch (aService) {
  886.         case "blogger_com":
  887.         case "livejournal_atom_com":
  888.         case "s_atom":
  889.         case "atom":
  890.             apiObject = new perFormancingAtomAPI();
  891.             break;
  892.         case "atom_blogger":
  893.         case "atom_blogger_cust":
  894.             apiObject = new perFormancingBloggerAtomAPI();
  895.             break;
  896.         case "livejournal_com":
  897.         case "blogger_cust":
  898.         case "s_blogger":
  899.         case "blogger":
  900.             apiObject = new perFormancingBloggerAPI();
  901.             break;
  902.         case "wordpress_com":
  903.         case "typepad_com":
  904.         case "wordpress_cust":
  905.         case "moveabletype_cust":
  906.         case "s_mt":
  907.         case "mt":
  908.             apiObject = new perFormancingMovableTypeAPI();
  909.             break;
  910.         case "metaweblog":
  911.         case "s_metaweblog":
  912.         case "msnspaces_com":
  913.             apiObject = new performancingMetaweblogAPI();
  914.             break;
  915.         default:
  916.             if (DEBUG) alert("Could not find API service.");
  917.             break;
  918.     }
  919.     
  920.     var myBlogPassword = gPerformancingUtil.goGetPassword(theXMLObject.username, theXMLObject.url);
  921.     apiObject.doSetup();
  922.     apiObject.init(theXMLObject.blogtype.toString(), theXMLObject.appkey.toString(), theXMLObject.apiurl.toString(), theXMLObject.blogid.toString(), null, theXMLObject.username.toString(),  myBlogPassword, false  );
  923.     
  924.     return apiObject;
  925. }
  926.  
  927. bfXMLRPC.makePingXML = function(theMethodName, theBlogName, theBlogURL) {
  928.          thePingXML = new XML();
  929.         //The Content for each Blog
  930.         thePingXML =
  931.                      <methodCall>
  932.                          <methodName>{theMethodName}</methodName>
  933.                           <params>
  934.                            <param>
  935.                            <value>{theBlogName}</value>
  936.                            </param>
  937.                            <param>
  938.                            <value>{theBlogURL}</value>
  939.                            </param>
  940.                           </params>
  941.                       </methodCall>;
  942.         return "<?xml version=\"1.0\"?>" + thePingXML.toXMLString();
  943. }
  944.  
  945. /*
  946.     Replace all Stupid XML Requests with this object
  947.     
  948.     USAGE:
  949.     //PffXmlHttpReq( aUrl, aType, aContent, aDoAuthBool, aUser, aPass) 
  950.     theCall = new PffXmlHttpReq('http://theurl.com', "GET", null, false, null, null);
  951.     
  952.     theCall.onResult = function (aText, aXML) {
  953.         alert("Good Result:" + aText);
  954.     }
  955.     theCall.onError = function (aStatusMsg, aXML) {
  956.         alert("Bad Result:" + aStatusMsg);
  957.     }
  958.     theCall.prepCall(); //Set up The call (open connection, etc.)
  959.     theCall.request.setRequestHeader("Content-Type", "text/xml");
  960.     theCall.makeCall(); //Make the call
  961.     theCall.makeCall();
  962.     theCall.request.overrideMimeType ('text/xml');
  963. */
  964. function PffXmlHttpReq( aUrl, aType, aContent, aDoAuthBool, aUser, aPass) {
  965.     this.url = aUrl;
  966.     this.posttype = aType;
  967.     this.content = aContent;
  968.     this.username = aUser;
  969.     this.password = aPass;
  970.     this.doAuth = aDoAuthBool;
  971.     //this.callback = aCallBackFunc;
  972.     this.request = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Components.interfaces.nsIXMLHttpRequest);
  973. }
  974.  
  975. PffXmlHttpReq.prototype.prepCall = function () {
  976.     
  977.     if(this.doAuth){
  978.         this.request.open(this.posttype, this.url, true, this.username, this.password);
  979.         
  980.         //Keeps stupid Authentication window from poping up
  981.         this.request.channel.notificationCallbacks = {
  982.             QueryInterface: function (iid) { // nsISupports
  983.                 if (iid.equals (Components.interfaces.nsISupports) ||
  984.                     iid.equals (Components.interfaces.nsIAuthPrompt) ||
  985.                     iid.equals (Components.interfaces.nsIInterfaceRequestor)) {
  986.                         return this;
  987.                 }
  988.                 throw Components.results.NS_ERROR_NO_INTERFACE;
  989.             },
  990.             getInterface: function (iid, result) { // nsIInterfaceRequestor
  991.                 if (iid.equals (Components.interfaces.nsIAuthPrompt)) {
  992.                     return this;
  993.                 }
  994.                 Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
  995.                 return null;
  996.             },
  997.             prompt: function (dialogTitle, text, passwordRealm, savePAssword, 
  998.                     defaultText, result) { // nsIAuthPromptInterface
  999.                 return false;
  1000.             },
  1001.             promptUsernameAndPassword: function (dialogTitle, text, 
  1002.                     passwordRealm, savePassword, user, pwd) {
  1003.                           //Didn't work, asking for password again
  1004.                 return false;
  1005.             },
  1006.             promptPassword: function (dialogTitle, text, passwordRealm, savePassword, user) {
  1007.                 return false;
  1008.             }
  1009.         }
  1010.     }else{
  1011.         this.request.open(this.posttype, this.url, true);
  1012.     }
  1013.     
  1014.     var request = this.request;
  1015.     var onResult = this.onResult;
  1016.     var onError = this.onError;
  1017.     this.request.onreadystatechange = function () {
  1018.         if(request.readyState == 4){ 
  1019.             if (request.status == 200 || request.status == 201 || request.status == 202){
  1020.                 onResult(request.responseText, request.responseXML);
  1021.             }else{
  1022.                 try{
  1023.                     onError(request.statusMessage, request.responseText);
  1024.                 }catch(e){}
  1025.             } 
  1026.         }
  1027.     }
  1028.     
  1029.     if(this.posttype.toLowerCase() == "post"){
  1030.         try{
  1031.             this.request.setRequestHeader('Content-Length', this.content.length );
  1032.         }catch(e){}
  1033.     }
  1034. }
  1035.  
  1036. PffXmlHttpReq.prototype.makeCall = function () {
  1037.     this.request.send(this.content)
  1038. }
  1039.    
  1040. /*
  1041.     Defined by Inheritor
  1042. */
  1043.  
  1044. PffXmlHttpReq.prototype.onError = function (message) {
  1045.     //foo
  1046. }
  1047.  
  1048. PffXmlHttpReq.prototype.onResult = function (aTestRes, aXMLRes) {
  1049.     //foo
  1050. }
  1051.  
  1052.